<template>
    <div class="login">
        <login-top navto_url='/register' navto_title="用户登陆" title='注册bilibili'></login-top>
        <login-input label="账号" @valueChange='input' style="margin:1rem 0" placeholder="你的手机/邮箱" name="id"></login-input>
        <login-input label="密码" @valueChange='input' type="password" placeholder="请输入密码" name="psw"></login-input>
        <login-button text='登录' @valueChange='input' style="margin-top:1.5rem" @submit="loginSubmit" ></login-button>
    </div>
</template>

<script>
import qs from 'qs'
import LoginTop from '../components/common/LoginTop.vue'
import LoginInput from '../components/common/LoginInput.vue'
import LoginButton from '../components/common/LoginButton.vue'
export default {
    data(){
        return {
            id:'',
            psw:''
        }
    },
    components:{
        LoginTop,
        LoginInput,
        LoginButton
    },
    methods:{
        input(value){
            this[event.target.name]=value
            console.log(this[event.target.name])
        },
        loginSubmit(){
            // let params=new FormData()
            // params.append('username',this.id)
            // params.append('password',this.psw)
            // console.log(params)
            var obj={
                source:'main_h5',
                token:'d4973f21fbc74ae185f9edf10000c8be',
                username:13058388918,
                password:'zn14RlDE73Dz58IjJy3CVHaK/y68hZPhSq95bC2oXAwXc/0EZZ5A/2TEcseBuv4QbAWRoK9WzDTQhqqeHhSdLxt4MGXlxWoWCZeHaHjAFlDGGI8abi84MU5OeecyQgqLQ82i9xpsH2/INUUXViQqWi0wMklGu2e5WJ89t4Bk8+E=',
                keep:true,
                go_url:'https://m.bilibili.com/space?from=headline',
                challenge:'bdcde3b9ead2295405acba3137d4b957',
                validate:'9ba22e89c7b3aa45cbe824937bd52b17',
                seccode:'9ba22e89c7b3aa45cbe824937bd52b17|jordan'
            }
            this.$axios.post('/passport/x/passport-login/web/login',qs.stringify(obj),{headers: {'Content-Type':"application/x-www-form-urlencoded;charset:UTF-8",}}).then((res)=>{
                console.log(res)
            })
            this.$axios.get('/passport/x/passport-login/web/key?r=0.8226278470651935').then((res)=>{
                console.log(res)
            })


        }
    }

}
</script>

